package com.chixing.day13_list;

import java.util.Iterator;
import java.util.TreeSet;

public class TreeSetDemo {
    public static void main(String[] args) {
        TreeSet<String> treeSet = new TreeSet<>();
        treeSet.add("hello");
        treeSet.add("world");
        treeSet.add("pace");
        treeSet.add("love");
        treeSet.add("hello");
        Iterator<String> iterator = treeSet.iterator();
        while (iterator.hasNext()){
            String s = iterator.next();
            System.out.println("迭代器string:"+s);
        }

        TreeSet<Student> studentTreeSet = new TreeSet<>();
        studentTreeSet.add(new Student(20,"ss"));
        System.out.println(studentTreeSet);
    }
}
